﻿using Shows.Data;
using Shows.DataModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ShowsAndCharacters.Controllers
{
    public class CharacterController : Controller
    {
        // GET: Character
        [HttpGet]
        public ActionResult AddCharacter()
        {

            return View();
        }
        [HttpPost]
        public ActionResult AddCharacter(string characterName, string photo, List<string> actors)
        {
            Character character = new Character();
            character.CharacterName = characterName;
            character.Photo = photo;
            character.Actors = actors;
            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                db.Characters.Add(character);
                db.SaveChanges();
            }
            return RedirectToAction("Home/ShowDetails" + character.Id);
        }
    }
}